

***** Call dataset
use "analysis.dta", clear
cd "Output"

**define treatment: before or after IO expiry
cap drop etime
g etime=t_count+100	
cap drop EXP
g EXP=0
replace EXP=1 if etime>=100


sort familie_id aar
local varlist "fambankakt fambankgaeld famoblakt famoblgaeld famkursakt famdispon_13 famboligvaerdi"
foreach v in `varlist' {
cap drop temp
g temp=`v' if etime==89
cap drop `v'_pre
bys familie_id: egen `v'_pre=max(temp)
cap drop l2_`v'
bys familie_id: g l2_`v'=l2.`v'
cap drop l1_`v'
bys familie_id: g l1_`v'=l1.`v'
}


** sample selection	: define group status based choice at expiration

cap drop temp
g temp=1 if inrange(etime,99,100)
cap drop ekeep
bys familie_id: egen ekeep=total(temp)
tab ekeep
keep if ekeep==2 /* Remove if not in dataset in year of expiry and the year before*/



* Set globals for regressions			
*****************************************************************************
global selection 	"if  rfamafdrag_for_cens!=. & rdiffconsump3_cens!=. & inrange(etime,96,103)" /*4 years before expiration, 3 years after*/
global typechoice " & type==0"			 /*keep until year ten and begin amortizing after*/
global controls		"i.alder_1 i.koen_1 i.aar i.kom l2_* i.famfastrente" /*controls*/

global cluster		"cluster(familie_id)" /*cluster at HH level*/

egen hh=group(familie_id)


*************************
**  FIGURE 1   **
*************************

	
*** 1A Installments
cap drop outvar
g outvar=rfamafdrag_for_cens*100
				qui reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Installments") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
			saving(fig_TG, replace)
 graph export "type0_installments.png", replace

 
*** 1B Consumption 
cap drop outvar
g outvar=rfamforbrug3_cens*100
				qui reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Consumption") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
			saving(fig_C, replace)
 graph export "type0_rC.png", replace

 
*** 1C Liquid assets 
cap drop outvar
g outvar=rdiffliq_assets_cens*100
				qui reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("{&Delta}Liquid wealth") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
			saving(fig_LA, replace)
 graph export "type0_rdLA.png", replace


*** 1D Bank debt 
cap drop outvar
g outvar=rdiffbankgaeld_cens*100
				qui reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("{&Delta}Bank debt") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
			saving(fig_BD, replace)
 graph export "type0_rDBD.png", replace

 
graph combine fig_TG.gph fig_C.gph fig_LA.gph fig_BD.gph, ycommon graphregion(col(white))
 graph export "REG_type0_all.pdf", replace
 erase fig_TG.gph 
 erase fig_C.gph 
 erase fig_LA.gph 
 erase fig_BD.gph
 
*************************
** TABLE 1 :BASELINE   **
*************************

gen expired=0
replace expired=1 if etime>=100

gen IO=1 if type==1
replace IO=0 if type==0

drop if type==3|type==6

reghdfe 		rfamafdrag_for_cens 		i.expired  $controls	$selection $typechoice , absorb(hh) cl(hh)
outreg2 using baseline.tex, replace dec(3) keep(i.expired)  ctitle(Instalments) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rfamforbrug3_cens 			i.expired   $controls	$selection $typechoice , absorb(hh) cl(hh)
 outreg2 using baseline.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffliq_assets_cens 		i.expired  $controls	$selection $typechoice , absorb(hh) cl(hh)
  outreg2 using baseline.tex, dec(3) keep(i.expired)  ctitle(Liquid Assets) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffbankgaeld_cens 		i.expired  $controls	$selection $typechoice , absorb(hh) cl(hh)
  outreg2 using baseline.tex, dec(3) keep(i.expired)  ctitle(Bank Debt) addtext(HH FE, Yes, HH Controls, Yes)

*************************
** TABLE 2 :MPC   **
*************************
 reghdfe rfamforbrug3_cens rfamafdrag_for_cens   $controls $selection $typechoice ,  absorb(hh)  cl(hh)
 outreg2 using iv.tex, replace dec(3) keep(rfamafdrag_for_cens)  ctitle(Expenditure, OLS) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	 	rfamafdrag_for_cens	  i.expired $controls	$selection $typechoice ,   absorb(hh)  
 outreg2 using iv.tex, dec(3) keep(i.expired)  ctitle(Instalments, First Stage) addtext(HH FE, Yes, HH Controls, Yes)

  ivreghdfe  rfamforbrug3_cens (rfamafdrag_for_cens=i.expired) $controls $selection $typechoice , absorb(hh) cl(hh) 
 outreg2 using iv.tex, dec(3) keep(rfamafdrag_for_cens)  ctitle(Expenditure, 2sls) addtext(HH FE, Yes, HH Controls, Yes, F Stat,297 )


*************************
** FIGURE 2:DISCONTINUITY   **
*************************

 cap drop numhome onehome
gen numhome=1 if famantalejerbol==1 & etime==99
 egen onehome=mean(numhome), by(familie_id)   
  
 gen ltvexp=fammax if etime==99
 egen LTV=mean(ltvexp),by(familie_id)
 
 gen ltvpost=fammax if etime==100
 egen LTVpost=mean(ltvpost),by(familie_id)

 cap drop limit80
   gen limit80=0	if inrange(LTV,1,80)
 replace limit80=1 if inrange(LTV,81,99999)

 cap drop rollover2
gen rollover2=0
replace rollover2=1 if type==1&LTVpost>=LTV
replace rollover2=. if type>1

cap drop stay
gen stay=1 if type==0 
replace stay=0 if type==1&LTVpost>=LTV	
cap drop expstay
g expstay=expired*stay
cap drop explimit80
g explimit80=expired*limit80

cap drop LTV2
gen LTV2=LTV^2

label var expired 	"Expired"
label var stay 		"Keep"
label var limit80 "LTV80"
label var LTV "LTV"
label var LTV2 "LTV (squared)"


*** densities and discontinuities 
global ivselection "& inlist(type,0,1) & limit80!=. "


		  twoway(kdensity LTV if stay==1&etime==100 $ivselection & LTV<=160) (kdensity LTV if stay==0&etime==100 $ivselection, xline(80, lpattern(dash))), graphregion(col(white))  ytitle(Density, size(large)) xtitle(LTV, size(large)) legend(order(1 "Keep" 2 "Rollover") pos(1) ring(0) col(1)) ///
			xlabel(0 "0"   40 "40"   80 "80" 120 "120"   160 "160")

graph save  "distributions2.gph", replace
	

*** full sample - linear fit
cap drop nbins
binscatter stay LTV if LTV>0 $ivselection ,  rd(80)   line(lfit)    ///
gen(nbins) ytitle("Propensity to keep original mortgage", size(large)) xtitle("LTV", size(large)) legend(off)
tabstat alder_1, by(nbins) stat(n)
graph save   "bscat_all_lfit.gph", replace
graph export   "bscat_all_lfit.pdf", replace

graph combine  "distributions2.gph" "bscat_all_lfit.gph",  graphregion(col(white))
graph export "Figure2.pdf", replace 



*************************
** TABLE 3: FUZZY REGRESSION DISCONTINUITY   **
*****************************

* first stage a
  ivreg2 	 	stay	  i.expired##i.limit80   LTV LTV2 $controls	$selection $ivselection ,   cl(hh)   first
 outreg2 using iv_rd.tex, replace dec(3) keep(1.expired 1.expired#1.limit80 1.limit80 LTV LTV2) label nocon ctitle(Keep, First Stage) addtext(HH FE, No, HH Controls, Yes)  
* first stage b  
  ivreg2 	 	expstay	  i.expired##i.limit80   LTV LTV2 $controls	$selection $ivselection ,   cl(hh)   first
 outreg2 using iv_rd.tex, dec(3) keep(1.expired 1.expired#1.limit80 1.limit80 LTV LTV2) label nocon ctitle(Expired $\times$ Keep, First Stage) addtext(HH FE, No, HH Controls, Yes)
* 2sls
ivreg2  rfamafdrag_for_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Installments, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat' )

qui ivreg2  rfamforbrug3_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection , cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Expenditure, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffliq_assets_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Liquid Assets, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffbankgaeld_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Bank Debt, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )




*************************
** APPENDIX A1   **
*************************

****NOTE: FIGURES A1/A2 STEM FROM AGGREGATE DATA


*************************
** FIGURE A3: PLACEBO CUTOFFS   **
*************************
cap drop nbins
binscatter stay LTV if LTV>=35&LTV<=85 $ivselection ,  rd(60) n(25) line(qfit)    ///
gen(nbins) ytitle("Propensity to keep original mortgage", size(large)) xtitle("LTV", size(large)) legend(off)
tabstat alder_1, by(nbins) stat(n)
graph save   "bscat_60_25.gph", replace 
cap drop nbins
binscatter stay LTV if LTV>=45&LTV<=95 $ivselection ,  rd(70) n(25) line(qfit)    ///
gen(nbins) ytitle("Propensity to keep original mortgage", size(large)) xtitle("LTV", size(large)) legend(off)
tabstat alder_1, by(nbins) stat(n)
graph save   "bscat_70_25.gph", replace 

	   graph combine "bscat_60_25.gph" "bscat_70_25.gph", ycommon
	   
	   graph export  "placebocombined.pdf", replace


*************************
** TABLE A1   **
*************************


*************************
** TABLE A2   **
*************************

gen dti=(famoblgaeld)/famperindkialt_13
gen si=(fambankakt+famkursakt+famoblakt)/(famperindkialt_13/12)

bysort type2: sum fammax dti famdispon_13 alder_1 si 

*************************
** TABLE A3   **
*************************
reg 	rfamforbrug3_cens 			i.expired  	$selection $typechoice , cl(hh)
outreg2 using sequencecontrols_new.tex, replace dec(3) keep(i.expired)  ctitle(Expenditure) addtext(Year FE, No, Municipality FE, No, HH FE, No, HH Controls, No)

 reg 	rfamforbrug3_cens i.expired  i.alder_1 i.koen_1 l2_* i.famfastrente	$selection $typechoice , cl(hh)
       outreg2 using sequencecontrols_new.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(Year FE, No, Municipality FE, No, HH FE, No, HH Controls, Yes)

reg 	rfamforbrug3_cens 		i.expired i.aar	$selection $typechoice , cl(hh)
outreg2 using sequencecontrols_new.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(Year FE, Yes, Municipality FE, No, HH FE, No, HH Controls, No)

reg 	rfamforbrug3_cens i.expired   i.kom 	$selection $typechoice , cl(hh)
outreg2 using sequencecontrols_new.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(Year FE, No, Municipality FE, Yes, HH FE, No, HH Controls, No)

reghdfe 	rfamforbrug3_cens i.expired    	$selection $typechoice , absorb(hh) cl(hh)
outreg2 using sequencecontrols_new.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(Year FE, No, Municipality FE, No, HH FE, Yes, HH Controls, No)


*************************
** TABLE A4   **
*************************


  gen changeincome=(famdispon_13-famdispon_13_pre)/famdispon_13_pre
  replace changeincome=. if etime!=99
  egen income=mean(changeincome), by(familie_id)
 
  
reghdfe 		rfamafdrag_for_cens 		i.expired  $controls	$selection $typechoice & income>0.3, absorb(hh) $cluster
outreg2 using income.tex, replace dec(3) keep(i.expired)  ctitle(Instalments) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rfamforbrug3_cens 			i.expired   $controls	$selection $typechoice &  income>0.3, absorb(hh) $cluster
 outreg2 using income.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffliq_assets_cens 		i.expired $controls	$selection $typechoice &  income>0.3, absorb(hh) $cluster
  outreg2 using income.tex, dec(3) keep(i.expired)  ctitle(Liquid Assets) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffbankgaeld_cens 		i.expired  $controls	$selection $typechoice &  income>0.3, absorb(hh) $cluster
  outreg2 using income.tex, dec(3) keep(i.expired)  ctitle(Bank Debt) addtext(HH FE, Yes, HH Controls, Yes)
  
  *************************
** TABLE A5   **
*************************



egen komy=group(kom aar)

qui reghdfe 		rfamafdrag_for_cens 		i.expired  $controls	$selection $typechoice , absorb(hh komy) cl(hh)
outreg2 using baseline_komy.tex, replace dec(3) keep(i.expired)  ctitle(Instalments) addtext(HH FE, Yes, HH Controls, Yes)

qui reghdfe 	rfamforbrug3_cens 			i.expired   $controls	$selection $typechoice , absorb(hh komy) cl(hh)
 outreg2 using baseline_komy.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(HH FE, Yes, HH Controls, Yes)

qui reghdfe 	rdiffliq_assets_cens 		i.expired  $controls	$selection $typechoice , absorb(hh komy ) cl(hh)
  outreg2 using baseline_komy.tex, dec(3) keep(i.expired)  ctitle(Liquid Assets) addtext(HH FE, Yes, HH Controls, Yes)

qui reghdfe 	rdiffbankgaeld_cens 		i.expired  $controls	$selection $typechoice , absorb(hh komy) cl(hh)
  outreg2 using baseline_komy.tex, dec(3) keep(i.expired)  ctitle(Bank Debt) addtext(HH FE, Yes, HH Controls, Yes)

*************************
** TABLE A6   **
*************************


  gen changevalue=(famboligvaerdi-famboligvaerdi_pre)/famboligvaerdi_pre
  replace changevalue=. if changevalue<=-1|changevalue>1 /*TRIM TOP BOTTOM 1%*/
  replace changevalue=. if etime!=99
  egen value=mean(changevalue), by(familie_id)
  
  
reghdfe 		rfamafdrag_for_cens 		i.expired  $controls	$selection $typechoice & value>0, absorb(hh) $cluster
outreg2 using value.tex, replace dec(3) keep(i.expired)  ctitle(Instalments) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rfamforbrug3_cens 			i.expired   $controls	$selection $typechoice & value>0, absorb(hh) $cluster
 outreg2 using value.tex, dec(3) keep(i.expired)  ctitle(Expenditure) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffliq_assets_cens 		i.expired $controls	$selection $typechoice & value>0, absorb(hh) $cluster
  outreg2 using value.tex, dec(3) keep(i.expired)  ctitle(Liquid Assets) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffbankgaeld_cens 		i.expired  $controls	$selection $typechoice & value>0, absorb(hh) $cluster
  outreg2 using value.tex, dec(3) keep(i.expired)  ctitle(Bank Debt) addtext(HH FE, Yes, HH Controls, Yes)

  *************************
** TABLE A7 : ROLLOVER GROUP  **
*************************

reghdfe 		rfamafdrag_for_cens 		i.expired##i.IO  $controls	$selection  , absorb(hh) cl(hh)
outreg2 using IO.tex, replace dec(3) keep(i.expired##i.IO)  ctitle(Instalments) addtext(HH FE, Yes, HH Controls, Yes)


 reghdfe 	rfamforbrug3_cens 			i.expired##i.IO   $controls	$selection , absorb(hh) cl(hh)
 outreg2 using IO.tex, dec(3) keep(i.expired##i.IO)  ctitle(Expenditure) addtext(HH FE, Yes, HH Controls, Yes)

 
 
 reghdfe 	rdiffliq_assets_cens 		i.expired##i.IO  $controls	$selection , absorb(hh) cl(hh)
  outreg2 using IO.tex, dec(3) keep(i.expired##i.IO)  ctitle(Liquid Assets) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffbankgaeld_cens 		i.expired##i.IO $controls	$selection  , absorb(hh) cl(hh)
  outreg2 using IO.tex, dec(3) keep(ii.expired##i.IO)  ctitle(Bank Debt) addtext(HH FE, Yes, HH Controls, Yes)
  
  
 *************************
** TABLE A8 : EARLY AMORTIZERS   **
*************************


preserve

append using "controlgroup.dta"

replace repayearly=0 if repayearly==.
replace repayearly=. if type!=0

tab repayearly type  $selection

replace lenght=9 if lenght==.

gen beginrepay=0 
 replace beginrepay=1 if repayearly==0&etime>=100
replace beginrepay=1 if lenght==7&etime>=98
replace beginrepay=1 if lenght==6&etime>=97

drop if y_laan==2002
**note that coefficients are different since we are adding multiple mortgages per family 

reghdfe 		rfamafdrag_for_cens 		i.beginrepay##i.repayearly   $controls	$selection  , absorb(hh) cl(hh)
outreg2 using Controlsep.tex, replace dec(3) keep(i.beginrepay##i.repayearly)  ctitle(Instalments) addtext(HH FE, Yes, HH Controls, Yes)

reghdfe 		rfamforbrug3_cens 		i.beginrepay##i.repayearly  $controls	$selection  , absorb(hh) cl(hh)
outreg2 using Controlsep.tex, dec(3) keep(i.beginrepay##i.repayearly)  ctitle(Expenditure) addtext(HH FE, Yes, HH Controls, Yes)

reghdfe 		rdiffliq_assets_cens 		i.beginrepay##i.repayearly $controls	$selection  , absorb(hh) cl(hh)
outreg2 using Controlsep.tex, dec(3) keep(i.beginrepay##i.repayearly)  ctitle(Liquid Assets) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffbankgaeld_cens 		i.beginrepay##i.repayearly  $controls	$selection  , absorb(hh) cl(hh)
outreg2 using Controlsep.tex, dec(3) keep(i.beginrepay##i.repayearly)  ctitle(Bank Debt) addtext(HH FE, Yes, HH Controls, Yes)

restore


 *************************
** TABLE A9 : CARS    **
*************************


gen car=kobtnybil+kobtbrugtbil
replace bilantal=0 if bilantal==.
replace car=0 if car==.


reghdfe 	bilantal 		i.expired    $controls	 $selection  $typechoice , absorb(hh) cl(hh)
outreg2 using carssep.tex, replace dec(3) keep(i.expired)  ctitle(Cars Owned) addtext(HH FE, Yes, HH Controls, Yes)

reghdfe 	car 		i.expired    $controls	 $selection  $typechoice , absorb(hh) cl(hh)
outreg2 using carssep.tex, dec(3) keep(i.expired)  ctitle(Cars Bought) addtext(HH FE, Yes, HH Controls, Yes)

reghdfe 	bilantal 		i.expired##i.IO    $controls	 $selection   , absorb(hh) cl(hh)
outreg2 using carssep.tex, dec(3) keep(i.expired##i.IO)  ctitle(Cars Owned) addtext(HH FE, Yes, HH Controls, Yes)

reghdfe 	car 		i.expired##i.IO    $controls	 $selection   ,absorb(hh) cl(hh)
outreg2 using carssep.tex, dec(3) keep(i.expired##i.IO)  ctitle(Cars Bought) addtext(HH FE, Yes, HH Controls, Yes)  
  
 *************************
** TABLE A10 : EDUCATION    **
*************************


 tostring famhoejstudda, gen(edu)
 gen education=substr(edu, 1,2) 
 destring education, gen(ED)
 gen highered=0
 replace highered=1 if ED>=60

reghdfe 		rfamafdrag_for_cens 		i.expired##i.highered  $controls	$selection $typechoice , absorb(hh) $cluster
outreg2 using education.tex, replace dec(3) keep(i.expired##i.highered)  ctitle(Instalments) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rfamforbrug3_cens 			i.expired##i.highered   $controls	$selection $typechoice , absorb(hh) $cluster
outreg2 using education.tex, dec(3) keep(i.expired##i.highered)  ctitle(Expenditure) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffliq_assets_cens 		i.expired##i.highered  $controls	$selection $typechoice , absorb(hh) $cluster
  outreg2 using education.tex, dec(3) keep(i.expired##i.highered)  ctitle(Liquid Assets) addtext(HH FE, Yes, HH Controls, Yes)

 reghdfe 	rdiffbankgaeld_cens 		i.expired##i.highered  $controls	$selection $typechoice , absorb(hh) $cluster
  outreg2 using education.tex, dec(3) keep(i.expired##i.highered)  ctitle(Bank Debt) addtext(HH FE, Yes, HH Controls, Yes)

  
  
 *************************
** TABLE A11 : DIFFERENT POLYNOMIAL ORDER    **
************************* 
 cap drop LTV3
gen LTV3=LTV^3

*****Panel A: full sample IV, linear 	
ivreg2  rfamafdrag_for_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly1.tex, replace dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV ) label nocon ctitle(Installments, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat' )

qui ivreg2  rfamforbrug3_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	     $controls	$selection  $ivselection , cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly1.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV ) label nocon ctitle(Expenditure, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffliq_assets_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly1.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV ) label nocon ctitle(Liquid Assets, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffbankgaeld_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly1.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV ) label nocon ctitle(Bank Debt, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

*****Panel B: full sample IV, quadratic 	
ivreg2  rfamafdrag_for_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly2.tex, replace dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Installments, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat' )

qui ivreg2  rfamforbrug3_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection , cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly2.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Expenditure, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffliq_assets_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly2.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Liquid Assets, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffbankgaeld_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly2.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Bank Debt, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

*****Panel B: full sample IV, cube 	
ivreg2  rfamafdrag_for_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2 LTV3	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly3.tex, replace dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2 LTV3) label nocon ctitle(Installments, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat' )

qui ivreg2  rfamforbrug3_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	LTV3     $controls	$selection  $ivselection , cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly3.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2 LTV3) label nocon ctitle(Expenditure, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffliq_assets_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	LTV3     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly3.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2 LTV3) label nocon ctitle(Liquid Assets, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffbankgaeld_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2 LTV3	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_poly3.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2 LTV3) label nocon ctitle(Bank Debt, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )


 *************************
** TABLE A12 : LOCAL LINEAR REGRESSION    **
*************************

*****banwidth selection and local linear regressions: note we take into account the nested DiD design by taking the bandiwth only at expiration (one obs per family)

***BAND SELECTION AS IN CALONICO ET.AL, (2017-2019) 

rdbwselect 	rfamforbrug3_cens LTV $selection  $ivselection &etime==100 , c(80) fuzzy(stay) 



****+/-25 from LTV =80 
***Panel B, 2sls
global window "&LTV>=55&LTV<=105"
qui ivreg2  rfamafdrag_for_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	  $controls   	$selection  $ivselection   $window,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_local25.tex, replace dec(3)   keep(1.expired 1.expired#1.stay 1.stay) label nocon ctitle(Installments, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'     )

qui ivreg2  rfamforbrug3_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	   $controls 	$selection  $ivselection  $window,  cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_local25.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay) label nocon ctitle(Expenditure, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'      )

qui ivreg2  rdiffliq_assets_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	 $controls    	$selection  $ivselection   $window,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_local25.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay) label nocon ctitle(Liquid Assets, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'     )

qui ivreg2  rdiffbankgaeld_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV 	 $controls   	$selection  $ivselection  $window,  cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_local25.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay) label nocon ctitle(Bank Debt, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'      )


***********************************************
*TABLE A13: EXCLUDING POTENTIAL MANIPULATORS
************************************************
  
 **** Borrowers with LTV>80 2-3 years before expiration who reduce mortgage debt in order to obtain LTV<80
 ***************************************************
 pause off
 preserve
 *pause
	keep if type==1
forval j=97/98	{
local k=`j'+1
	cap drop temp
	g temp=1 if fammaxltv>81 & etime==`j'
	cap drop above`j'
	bys familie_id: egen above`j'=max(temp)
		replace above`j'=0 if above`j'==.
		tab above`j'
	cap drop temp
	g temp=.
	replace temp=1 if famrestobl<famrestobl_lag & fammaxltv<80 & etime==`k'
	cap drop reduced`k'
	bys familie_id: egen reduced`k'=max(temp)
		replace reduced`k'=0 if reduced`k'==.
		tab reduced`k'
	tab above`j' reduced`k'
}
g exclude=.
replace exclude=1 if above97==1 & reduced98==1
replace exclude=1 if above98==1 & reduced99==1
keep if exclude==1
keep familie_id exclude
*collapse exclude, by(familie_id)
 duplicates drop
pause
tempfile excludesample
save `excludesample'
 restore
merge m:1 familie_id using `excludesample'
 
 
*** Table 
preserve 
drop if exclude==1 
***********************
****Table 3: IV RD (OLS)
global ivselection "& inlist(type,0,1) & limit80!=. "
* first stage a
  ivreg2 	 	stay	  i.expired##i.limit80   LTV LTV2 $controls	$selection $ivselection ,   cl(hh)   first
 outreg2 using iv_rd_exclude.tex, replace dec(3) keep(1.expired 1.expired#1.limit80 1.limit80 LTV LTV2) label nocon ctitle(Keep, First Stage) addtext(HH FE, No, HH Controls, Yes)  
* first stage b  
  ivreg2 	 	expstay	  i.expired##i.limit80   LTV LTV2 $controls	$selection $ivselection ,   cl(hh)   first
 outreg2 using iv_rd_exclude.tex, dec(3) keep(1.expired 1.expired#1.limit80 1.limit80 LTV LTV2) label nocon ctitle(Expired $\times$ Keep, First Stage) addtext(HH FE, No, HH Controls, Yes)
* 2sls
ivreg2  rfamafdrag_for_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_exclude.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Installments, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat' )

qui ivreg2  rfamforbrug3_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection , cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_exclude.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Expenditure, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffliq_assets_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_exclude.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Liquid Assets, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )

qui ivreg2  rdiffbankgaeld_cens (i.expired#i.stay i.stay=i.expired#i.limit80 i.limit80)  i.expired   LTV LTV2	     $controls	$selection  $ivselection ,   cl(hh) 
local Fstat=e(F)
outreg2 using iv_rd_exclude.tex, dec(3)   keep(1.expired 1.expired#1.stay 1.stay LTV LTV2) label nocon ctitle(Bank Debt, 2sls) addtext(HH FE, No, HH Controls, Yes, F stat, `Fstat'   )
restore


  
 ***********************************
** APPENDIX A2 :ALTERNATIVE SPECIFICATION
******************************************

/*1 Construct installments line for rollovers had they not rolled over
*/
 pause off
 preserve
 *pause

 xtset familie_id aar

 cap drop ydelse_beregn rentesats afdrag nyrestgaeld
  cap drop temp
  g temp=famrente_bet_nu/(famrestobl_lag/2+famrestobl/2) if etime==99
  bys familie_id: egen rentesats=max(temp)
  cap drop temp
  g temp=famrestobl*(rentesats/4)/(1-(1+(rentesats/4))^(-20*4))*4 if etime==99
 bys familie_id: egen ydelse_beregn=max(temp)
	drop temp
 g afdrag=ydelse_beregn-rentesats*l.famrestobl if etime==100
 g nyrestgaeld=l.famrestobl-afdrag
 forval t=101/104 {
 replace afdrag=ydelse_beregn-rentesats*l.nyrestgaeld if etime==`t'
 replace nyrestgaeld=l.nyrestgaeld-afdrag if etime==`t'
 }
 
 cap drop temp
 g temp=afdrag/famdispon_13[_n-1]
 *Censoring variables
local varlist 	temp
foreach v in `varlist' {
cap drop `v'_cens
g `v'_cens=`v'
forval t=1998/2017 {
qui sum `v' if aar==`t',d
replace `v'_cens=r(p1) if `v'_cens<r(p1) & `v'_cens!=. & aar==`t'
replace `v'_cens=r(p99) if `v'_cens>r(p99) & `v'_cens!=. & aar==`t'
}
}


**Figure A2(1)-left-hand
***chart in installments: baseline +rollover
cap drop outvar
g outvar=max(0,temp_cens)*100
global typechoice " & inlist(type,0,1) "			
eststo planned:	 reghdfe 	outvar  i.etime 	$selection  $typechoice ,noabsorb
 cap drop outvar
g outvar=rfamafdrag_for_cens*100
global typechoice " & inlist(type,0,0) "			
eststo type0:	 reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
global typechoice " & inlist(type,0,1) "			
eststo type0_1:	 reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)


coefplot 	(planned, offset(0.05))  ///
			(type0, offset(0.05))  ///
			(type0_1, offset(0.05))  ///
, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 p1(ciopts(lw(0))) p2(msymbol(T)) p3(msymbol(Th)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Installments") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
		 legend(order(2 "Planned" 4 "Baseline" 6 "Baseline+rollover"  ) col(1) pos(11) ring(0)) 
 graph export "installments_revision.png", replace

 
**Figure A2(1)-right-hand
 ****** CONSUMPTION for baseline and baseline+rollover
 ***************************
  cap drop outvar
g outvar=rfamforbrug3_cens*100
global typechoice " & inlist(type,0,0) "			
eststo type0:	 reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
global typechoice " & inlist(type,0,1) "			
eststo type0_1:	 reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
*global typechoice " & inlist(type,1,1) "			
*eststo type1:	 reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot 	(type0, offset(0.05))  ///
			(type0_1, offset(0.05))  ///
			/*(type1, offset(0.05))*/  ///
, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Consumption") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
		 ysc(r(-20(10)40)) ylab(-20(10)40) ///
		 legend(order(2 "Baseline" 4 "Baseline+rollover" ) col(1) pos(11) ring(0))
 graph export "consumption_revision.png", replace
  
****** Appendix A2, Figure 2
*CONSUMPTION for rollover sample only
 ***************************
  cap drop outvar
g outvar=rfamforbrug3_cens*100
global typechoice " & inlist(type,1,1) "			
eststo type1:	 reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot 	/*(type0, offset(0.05))  ///
			(type0_1, offset(0.05))*/  ///
			(type1, offset(0.05))  ///
, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Consumption") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
		 ysc(r(-20(10)40)) ylab(-20(10)40) /* ///
		 legend(order(2 "Rollover" ) col(1) pos(11) ring(0)) */
 graph export "consumption_revision2.png", replace
  
****** Appendix A2, Figure 2
*Mortgage balances for rollover sample only
 ***************************
  cap drop outvar
g outvar=rdiffrestobl_cens*100
global typechoice " & inlist(type,1,1) "			
eststo type1:	 reghdfe 	outvar  i.etime $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot 	/*(type0, offset(0.05))  ///
			(type0_1, offset(0.05))*/  ///
			(type1, offset(0.05))  ///
, vertical baselevels omitted keep(*.etime) rename(*.etime="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Mortgage debt") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
		 		 ysc(r(-20(10)40)) ylab(-20(10)40) /* ///
		 legend(order(2 "Rollover" ) col(1) pos(11) ring(0)) */
 graph export "mortgage_revision2.png", replace
  
 
*Appendix A2, Figure 3
***Baseline +early amortizers: installments chart
pause off
preserve
tab lenght
pause
 append using "controlgroup.dta"
pause

replace repayearly=0 if repayearly==.
replace repayearly=. if type!=0

tab repayearly type  $selection
tab lenght
sort familie_id aar

drop if type==99 & rfamafdrag_for_cens==.
keep if inlist(type,0,99)
g 		etime_new=aar-treat_aar+100
tab etime etime_new if inrange(etime,94,104) & inrange(etime_new,94,104)
replace type=99 if lenghtio==6
replace type=99 if lenghtio==7

drop if y_laan==2002
pause
***

 cap drop ydelse_beregn rentesats afdrag nyrestgaeld
  cap drop temp
  g temp=famrente_bet_nu/(famrestobl_lag/2+famrestobl/2) if etime_new==99
  bys familie_id: egen rentesats=max(temp)
  cap drop temp
  g temp=famrestobl*(rentesats/4)/(1-(1+(rentesats/4))^(-20*4))*4 if etime_new==99
 bys familie_id: egen ydelse_beregn=max(temp)
	drop temp
 g afdrag=ydelse_beregn-rentesats*l.famrestobl if etime_new==100
 g nyrestgaeld=l.famrestobl-afdrag
 forval t=101/104 {
 replace afdrag=ydelse_beregn-rentesats*l.nyrestgaeld if etime_new==`t'
 replace nyrestgaeld=l.nyrestgaeld-afdrag if etime_new==`t'
 }
 
 cap drop temp
 g temp=afdrag/famdispon_13[_n-1]
 *Censoring variables
local varlist 	temp 
foreach v in `varlist' {
cap drop `v'_cens
g `v'_cens=`v'
forval t=1998/2017 {
qui sum `v' if aar==`t',d
replace `v'_cens=r(p1) if `v'_cens<r(p1) & `v'_cens!=. & aar==`t'
replace `v'_cens=r(p99) if `v'_cens>r(p99) & `v'_cens!=. & aar==`t'
}
}

cap drop outvar
g outvar=max(0,temp_cens)*100
global typechoice " & inlist(type,0,99) "			
eststo planned:	 reghdfe 	outvar  i.etime_new 	$selection  $typechoice ,noabsorb
 cap drop outvar
g outvar=rfamafdrag_for_cens*100
global typechoice " & inlist(type,0,0) "			
eststo type0:	 reghdfe 	outvar  i.etime_new $controls	$selection  $typechoice , absorb(hh) cl(hh)
global typechoice " & inlist(type,0,99) "			
eststo type0_1:	 reghdfe 	outvar  i.etime_new $controls	$selection  $typechoice , absorb(hh) cl(hh)

coefplot 	(planned, offset(0.05))  ///
			(type0, offset(0.05))  ///
			(type0_1, offset(0.05))  ///
, vertical baselevels omitted keep(*.etime_new) rename(*.etime_new="") graphregion(col(white)) ///
		 p1(ciopts(lw(0))) p2(msymbol(T)) p3(msymbol(Th)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Installments") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
		 legend(order(2 "Planned" 4 "Baseline" 6 "Baseline+early amortize"  ) col(1) pos(11) ring(0)) 
 graph export "installments_revision_early.png", replace

 
****** Appendix A2, Figure 3
*CONSUMPTION for baseline and baseline+early
 ***************************
  cap drop outvar
g outvar=rfamforbrug3_cens*100
global typechoice " & inlist(type,0,0) "			
eststo type0:	 reghdfe 	outvar  i.etime_new $controls	$selection  $typechoice , absorb(hh) cl(hh)
global typechoice " & inlist(type,0,99)  "			
eststo type0_1:	 reghdfe 	outvar  i.etime_new $controls	$selection  $typechoice , absorb(hh) cl(hh)
*global typechoice " & inlist(type,1,1) "			
*eststo type1:	 reghdfe 	outvar  i.etime_new $controls	$selection  $typechoice , absorb(hh) cl(hh)
coefplot 	(type0, offset(0.05))  ///
			(type0_1, offset(0.05))  ///
			/*(type1, offset(0.05))*/  ///
, vertical baselevels omitted keep(*.etime_new) rename(*.etime_new="") graphregion(col(white)) ///
		 yline(0, lcol(black)) ytitle("% of lagged income") xtitle("Time to expiration") title("Consumption") ///
		 xlabel( 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "1" 7 "2" 8 "3") xline(4.5, lpattern(dash)) ///
		 ysc(r(-20(10)40)) ylab(-20(10)40) ///
		 legend(order(2 "Baseline" 4 "Baseline+early amortize" ) col(1) pos(11) ring(0))
 graph export "consumption_revision_early.png", replace
  restore
